#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long n,q,x,v,y,b[8010],a[8010],num;
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%lld%lld",&n,&q);
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i]);
		b[i]=a[i];
	}
	for(int i=1;i<=q;i++){
		scanf("%lld",&y);
		if(y==1){
			scanf("%lld%lld",&x,&v);
			a[x]=v;
		}else{
			scanf("%lld",&x);
			for(int j=1;j<=n;j++)b[j]=a[j];
			sort(b+1,b+n+1);
			num=lower_bound(b+1,b+n+1,a[x])-b;
			printf("%lld\n",num);
		}
	}
}
